#add_column(table_name, column_name, type, options): 
#Adds a new column to the table called table_name 
#named column_name specified to be one of the following types: 
#:string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean. 
#A default value can be specified by passing an options hash like { :default => 11 }. 
#Other options include :limit and :null (e.g. { :limit => 50, :null => false }) 
#— see ActiveRecord::ConnectionAdapters::TableDefinition#column for details. 

class CreateAuthors < ActiveRecord::Migration
  def self.up
    create_table :authors do |t|
      t.column :name,     :string
      t.column :age,      :integer, :default => 18
      t.column :birthday, :date,    :default => '1980-01-01'
      t.column :money,    :float,   :default => 0
      t.column :email,    :string
      t.column :nation,   :string,  :default => '中国'
      t.column :province, :string,  :default => '浙江'
      t.column :city,     :string,  :default => '杭州'
      t.column :address,  :string,  :default => ''
      t.column :postcode, :string
      t.column :phone,    :string
      t.column :memo,     :text
    end
  end

  def self.down
    drop_table :authors
  end
end
